﻿/*
[/filesystem/filesystem.js]
*/

Ext.namespace("tk","tk.yunos","tk.yunos.system");

tk.yunos.system.FileMgr = function(fileDescriptor, _config){
	var panel = new tk.yunos.system.FileMgr.Panel(fileDescriptor, _config);
	var appName = tk.yunos.system.FileMgr.appname;
	var winParams = {
		title: appName + '[' + fileDescriptor.address + ']',
		icon: fileDescriptor.icon,
		layout: 'fit',
		items: [
		    panel
		]
	};
	var win = tk.yunos.system.GLOBAL_WINDOWMGR.newWindow(winParams);
	win.show();
	panel.on('change', function(oldAddress, newAddress){
		win.setTitle(appName + '[' + newAddress + ']');
	});
};

tk.yunos.system.FileMgr.Panel = function(fileDescriptor, _config){
	var fileMgr = this;
	var config = _config || {};
	var orientation = config.orientation;					//图标摆放方向，'horizontal'|'vertical'
	var iconSize = config.iconSize || 'medium';				//图标大小，'large'|'medium'|'small'
	var hideToolbar = config.hideToolbar || false;			//是否隐藏工具栏（包括导航条和地址栏）
	var folderInNewWindow = config.folderInNewWindow || false;	//是否在新窗口中打开文件夹
	var forSelect = config.forSelect || false;				//是否是选择窗口
	var selectMimes = config.selectMimes;					//候选文件类型
	var selectHandler = config.selectHandler;				//选择文件后的动作
	var structTree = config.structTree || false;			//是否显示文件夹结构树
	
	if(!orientation || orientation != 'vertical'){
		orientation = 'horizontal';
	}
	
	if(iconSize != 'large' && iconSize != 'small'){
		iconSize = 'medium';
	}
	
	//当前绝对路径
	var curAbsAddress = config.address || '/';
	if(fileDescriptor && fileDescriptor.address){
		curAbsAddress = fileDescriptor.address;
	}
	if(curAbsAddress.charAt(0) != '/'){
		Ext.Msg.alert('警告', '初始地址必须为绝对地址(以"/"开头)');
		return new Ext.Panel();
	}
	//绝对路径的文件夹结构
	var foldArchitecture = null;
	//所有图标方块
	var allTofus = null;
	//该路径下的所有文件(夹)
	var allFiles;
	//历史
	var history = new tk.yunos.system.FileMgr.History();
	//选中的tofu块
	var selectedTofus = new YOSUtil.SingleArray();
	
	//私有，跳转到地址，支持相对地址，参数saveHistory表示是否保存历史
	var privateGotoAddress = function(address, saveHistory){
		if(address.charAt(0) != '/'){
			//如果是相对地址，则绝对地址为当前地址拼上相对地址
			address = (curAbsAddress + '/' + address).replace(/\/+/g, "\/");
		}
		if(allFiles == null || address != curAbsAddress){
			if(fileMgr.getWindow && fileMgr.getWindow()){
				fileMgr.getWindow().wait();
			}
			fileMgr.fireEvent('change', curAbsAddress, address);
			tk.yunos.filesystem.getFiles(address, function(success, files){
				if(success){
					//处理地址
					foldArchitecture = tk.yunos.system.FileMgr.analyzeAddress(address);
					curAbsAddress = address;
					addressBar.setValue(curAbsAddress);
					selectedTofus.clear();
					//处理历史
					if(saveHistory){
						history.add(curAbsAddress);
					}
					if(history.getBackableHistorys().length > 0){
						backBtn.enable();
					}else{
						backBtn.disable();
					}
					if(history.getForwardableHistorys().length > 0){
						forwardBtn.enable();
					}else{
						forwardBtn.disable();
					}
					if(foldArchitecture.length > 1){
						upBtn.enable();
					}else{
						upBtn.disable();
					}
					if(forSelect && selectMimes){
						allFiles = [];
						for(var i = 0; i < files.length; i++){
							if(files[i].mime == 'folder' || selectMimes.indexOf(files[i].mime) > -1){
								allFiles.push(files[i]);
							}
						}
					}else{
						allFiles = files;
					}
					//摆放图标
					allTofus = null;
					layIcons();
				}else{
					//失败，说明地址指向的文件夹不存在
					addressBar.markInvalid();
				}
				if(fileMgr.getWindow && fileMgr.getWindow()){
					fileMgr.getWindow().finish();
				}
			});
		}else{
			//地址没有改变，仅重新摆放图标
			layIcons();
		}
	};
	
	//摆放图标方块方法
	//参数rebuildIcon： 是否重建图标缓存
	var layIcons = function(rebuildIcon){
		if(allTofus == null || rebuildIcon){
			//重建所有的图标方块
			allTofus = [];
			for(var i = 0; i < allFiles.length; i++){
				allTofus.push(new tk.yunos.system.FileMgr.Tofu(allFiles[i], fileMgr, iconSize));
			}
		}
		var tableEl;
		if(allTofus.length > 0){
			var iconWidth = allTofus[0].getComputedWidth();
			var iconHeight = allTofus[0].getComputedHeight();
			//如果iconWidth或者iconHeight为0，则尝试将图标块挂到body上，再取其宽高
			if(iconWidth == 0 || iconHeight == 0){
				var tofuTmp = new tk.yunos.system.FileMgr.Tofu(allFiles[0], fileMgr, iconSize);
				contentArea.body.appendChild(tofuTmp);
				iconWidth = tofuTmp.getComputedWidth();
				iconHeight = tofuTmp.getComputedHeight();
				tofuTmp.remove();
			}
			var tableWidth = contentArea.body.width;
			var tableHeight = contentArea.body.height;
			if(orientation == 'horizontal'){
				contentArea.body.dom.style.overflowX = 'hidden';
				contentArea.body.dom.style.overflowY = 'auto';
				tableWidth = tableWidth - 25;		//减去滚动条的宽度
			}else{
				contentArea.body.dom.style.overflowX = 'auto';
				contentArea.body.dom.style.overflowY = 'hidden';
				tableHeight = tableHeight - 25;		//减去滚动条的高度
			}
			tableEl = document.createElement('table');
			tableEl.cellPadding = '0';
			tableEl.cellSpacing = '10';
			var rowCount = Math.floor(tableHeight / iconHeight);
			rowCount = rowCount == 0 ? 1 : rowCount;			
			var cellCount = Math.floor(tableWidth / iconWidth);
			cellCount = cellCount == 0 ? 1 : cellCount;
			for(var i = 0; i < allTofus.length; i++){
				if(orientation == 'horizontal'){
					var rowIndex = Math.floor(i / cellCount);
					var cellIndex = Math.floor(i % cellCount);
				}else{
					var rowIndex = Math.floor(i % rowCount);
					var cellIndex = Math.floor(i / rowCount);
				}
				if(!tableEl.rows[rowIndex]){
					tableEl.insertRow(rowIndex);
				}
				if(!tableEl.rows[rowIndex].cells[cellIndex]){
					var cell = tableEl.rows[rowIndex].insertCell(cellIndex);
					//cell.width = iconWidth + 'px';
				}
				tableEl.rows[rowIndex].cells[cellIndex].appendChild(allTofus[i].dom);
			}
		}
		var iconTable = contentArea.body.first();
		if(iconTable){
			iconTable.remove();
		}
		if(tableEl){
			contentArea.body.appendChild(tableEl);
			contentArea.body.repaint();
		}
	};
	
	//生成右键菜单
	this.generateContextMenu = function(){
		//右键菜单
		var contextMenu = new Ext.menu.Menu({
			ignoreParentClicks: true,
			items: [{
				text: '查看',
				menu: [{
					text: '大图标',
					checked: iconSize == 'large',
					group: 'iconSize',
					handler: function(){
						fileMgr.setIconSize('large');
					}
				},{
					text: '中图标',
					checked: iconSize == 'medium',
					group: 'iconSize',
					handler: function(){
						fileMgr.setIconSize('medium');
					}
				},{
					text: '小图标',
					checked: iconSize == 'small',
					group: 'iconSize',
					handler: function(){
						fileMgr.setIconSize('small');
					}
				}]
			},{
				text: '排序',
				menu: [{
					text: '按名称',
					checked: false,
					group: 'sort',
					handler: function(item){
						allFiles.sort(function(a, b){
							return a.name.localeCompare(b.name);
						});
						layIcons(true);
					}
				},{
					text: '按类型',
					checked: false,
					group: 'sort',
					handler: function(item){
						allFiles.sort(function(a, b){
							return a.mime.localeCompare(b.mime);
						});
						layIcons(true);
					}
				}]
			},{
				text: '刷新',
				handler: function(){
					fileMgr.refresh();
				}
			},{
				text: '粘贴',
				disabled: tk.yunos.filesystem.COPY_QUEUE.length() == 0,
				handler: function(){
					allFiles.push(tk.yunos.filesystem.COPY_QUEUE.pop());
					layIcons(true);
				}
			},{
				text: '新建',
				menu: [{
					text: '文件夹(演示)',
					handler: function(){
						allFiles.push({
							name: '新建文件夹',
							mime: 'folder',
							fileMgr: fileMgr,
							icon: tk.yunos.filesystem.DEFAULT_MIME['folder'].icon
						});
						layIcons(true);
						allTofus[allTofus.length - 1].rename();
					}
				},{
					text: 'web应用(演示)',
					handler: function(item, e){
						var win = new Ext.Window({
							title: '新建web应用',
							constrainHeader: true,
							width: 400,
							height: 150,
							border: false,
							layout: 'form',
							labelWidth: 60,
							labelAlign: 'right',
							items: [{
								xtype: 'textfield',
								fieldLabel: '文件名',
								anchor: '100%',
								value: '百度',
								allowBlank: false
							},{
								xtype: 'textfield',
								fieldLabel: '网址',
								value: 'http://www.baidu.com',
								anchor: '100%',
								allowBlank: false
							},{
								xtype: 'textfield',
								fieldLabel: '图标网址',
								anchor: '100%',
								value: 'http://home.baidu.com/resource/r/home/img/logo-yy.gif'
							}],
							buttonAlign: 'center',
							buttons: [{
								text: '确定',
								handler: function(){
									if(!win.items.items[0].validate() || !win.items.items[1].validate()){
										return;
									}
									var icon = win.items.items[2].getValue();
									if(icon == ''){
										icon = tk.yunos.filesystem.DEFAULT_MIME['web-app'].icon;
									}
									allFiles.push({
										name: win.items.items[0].getValue(),
										mime: 'web-app',
										fileMgr: fileMgr,
										url: win.items.items[1].getValue(),
										icon: icon
									});
									layIcons(true);
									allTofus[allTofus.length - 1].rename();
									win.close();
								}
							},{
								text: '取消',
								handler: function(){
									win.close();
								}
							}]
						});
						win.show();
						win.setPosition(item.parentMenu.getPosition());
					}
				}]
			},{
				text: '图标方向',
				menu: [{
					text: '横向',
					checked: orientation == 'horizontal',
					group: 'orientation',
					handler: function(){
						fileMgr.setOrientation('horizontal');
					}
				},{
					text: '纵向',
					checked: orientation == 'vertical',
					group: 'orientation',
					handler: function(){
						fileMgr.setOrientation('vertical');
					}
				}]
			}]
		});
		return contextMenu;
	};
	
	//刷新
	this.refresh = function(){
		var curAbsAddressTmp = curAbsAddress;
		curAbsAddress = '';
		privateGotoAddress(curAbsAddressTmp, false);
	};
	
	//跳转到地址，支持相对地址
	this.gotoAddress = function(address){
		privateGotoAddress(address, true);	//保存历史
	};
	//获取当前地址，得到的是绝对地址
	this.getCurAbsAddress = function(){
		return curAbsAddress;
	};
	
	//获取所有图标方块
	this.getAllTofus = function(){
		return allTofus;
	};
	
	//获取所有文件（夹）
	this.getAllFiles = function(){
		return allFiles;
	};
	
	//获取图标摆放方向
	this.getOrientation = function(){
		return orientation;
	};
	
	//设置图标摆放方向
	this.setOrientation = function(o){
		orientation = o;
		if(!orientation || orientation != 'vertical'){
			orientation = 'horizontal';
		}
		layIcons();
	};
	
	//获取图标大小
	this.getIconSize = function(){
		return iconSize;
	};
	
	//设置图标大小
	this.setIconSize = function(size){
		iconSize = size;
		if(!iconSize || (iconSize != 'large' && iconSize != 'small')){
			iconSize = 'medium';
		}
		layIcons(true);
	};
	
	//重建图标缓存
	this.rebuildIcons = function(){
		layIcons(true);
	};
	
	//获取选中的toufu块
	this.getSelectedTofus = function(){
		return selectedTofus;
	};
	
	//构造面板各部分
	var addressBar = new Ext.form.TextField({
		columnWidth: 0.98,
		xtype: 'textfield',
		value: config.address,
		style: 'margin-right:2px;margin-left:5px;',
		height: 24,
		enableKeyEvents: true,
		invalidText: '地址不正确',
		listeners: {
			'keypress': function(tf, e){
				if(e.browserEvent.keyCode == e.ENTER){
					privateGotoAddress(addressBar.getValue(), true);
				}
			}
		}
	});
	
	var sidebarBtn = new Ext.Button({
		iconCls: 'sidebar',
		tooltip: '文件夹结构侧边栏',
		enableToggle: true,
		pressed: structTree,
		toggleHandler: function(btn, state){
			if(state){
				st.show();
				fileMgr.doLayout();
			}else{
				st.hide();
				fileMgr.doLayout();
			}
		}
	});
	
	var backBtn = new Ext.Button({
		iconCls: 'back',
		tooltip: '后退',
		handler: function(){
			privateGotoAddress(history.back(), false);
		}
	});
	
	var forwardBtn = new Ext.Button({
		iconCls: 'forward',
		tooltip: '前进',
		handler: function(){
			privateGotoAddress(history.forward(), false);
		}
	});
	
	var upBtn = new Ext.Button({
		iconCls: 'up',
		tooltip: '上级目录',
		handler: function(){
			privateGotoAddress(tk.yunos.system.FileMgr.joinAddress(foldArchitecture.slice(0, foldArchitecture.length - 1)), true);
		}
	});
	
	var toolPanel = new Ext.Panel({
		hidden: hideToolbar,
		region: 'north',
		layout: 'column',
		frame: true,
		height: 40,
		defaultType: 'button',
		defaults: {
			width: 30
		},
		items: [
			sidebarBtn,backBtn,forwardBtn,upBtn,addressBar,{
				iconCls: 'goto',
				width: 50,
				handler: function(){
					privateGotoAddress(addressBar.getValue(), true);
				}
			}
		]
	});
	
	var contentArea = new Ext.Panel({
		region: 'center',
		border: false,
		listeners: {
			'afterrender': function(panel){
				panel.body.highlight();
			},
			'render': function(panel){
				//添加点击事件
				panel.body.on('click', function(){
					for(var i = 0; i < allTofus.length; i++){
						allTofus[i].unselect();
					}
				});
				//右键菜单
				panel.body.on('contextmenu', function(event, element){
					event.preventDefault();
					fileMgr.generateContextMenu().showAt(event.getXY());
				});
			},
			'resize': function(panel, newWidth, newHeight){
				contentArea.body.width = newWidth;
				contentArea.body.height = newHeight;
				privateGotoAddress(curAbsAddress, true);
			}
		}
	});
	
	//文件夹结构侧边栏
	var st = new tk.yunos.system.FileMgr.StructTree({
		region: 'west',
		width: 120,
		hidden: !structTree,
		rootPath: '/',
		listeners: {
			'click': function(node){
				privateGotoAddress(node.attributes.address, true);
			}
		}
	});
	
	config.layout = 'border';
	config.items = [toolPanel,contentArea, st];
	
	if(forSelect){
		config.buttonAlign = 'center';
		config.buttons = [{
			text: '确定',
			handler: function(){
				if(selectHandler){
					selectHandler(fileMgr, selectedTofus);
				}
			}
		}];
	}
	
	Ext.apply(this, config);
	//调用父类构造方法
	tk.yunos.system.FileMgr.Panel.superclass.constructor.call(this, config);
	
	this.addEvents(
		'tofuclick','tofuselect','tofuunselect','tofudbclick','tofucontextmenu','change'
	);
	
	var openFile = function(fileDescriptor){
		if(fileDescriptor.mime == 'folder' && !folderInNewWindow){
			fileMgr.gotoAddress(fileDescriptor.name);
		}else{
			tk.yunos.filesystem.openFile(fileDescriptor);
		}
	};
	
	this.on('tofuclick', function(clickedTofu, e){
		e.stopPropagation();
		for(var i = 0; i < allTofus.length; i++){
			if(clickedTofu != allTofus[i]){
				allTofus[i].unselect();
			}
		}
		clickedTofu.select();
	});
	
	this.on('tofudbclick', function(clickedTofu, e){
		if(forSelect && clickedTofu.getFile().mime != 'folder'){
			if(selectHandler){
				selectHandler.call(this, fileMgr, selectedTofus);
			}
		}else{
			openFile(clickedTofu.getFile());
		}
	});
	
	this.on('tofucontextmenu', function(clickedTofu, e){
		e.preventDefault();
		e.stopPropagation();
		for(var i = 0; i < allTofus.length; i++){
			allTofus[i].unselect();
		}
		clickedTofu.select();
		var contextMenu = new Ext.menu.Menu({
			ignoreParentClicks: true,
			items: [{
				text: '打开',
				handler: function(){
					openFile(clickedTofu.getFile());
				}
			},{
				text: '复制(演示)',
				handler: function(){
					tk.yunos.filesystem.COPY_QUEUE.push(clickedTofu.getFile());
				}
			},{
				text: '删除(演示)',
				handler: function(){
					for(var i = 0; i < allFiles.length; i++){
						if(allFiles[i].name == clickedTofu.getFile().name){
							allFiles.splice(i, 1);
							break;
						}
					}
					fileMgr.rebuildIcons();
				}
			},{
				text: '重命名(演示)',
				handler: function(){
					clickedTofu.unselect();
					clickedTofu.rename();
				}
			}]
		});
		contextMenu.showAt(e.getXY());
	});
	
	this.on('tofuselect', function(selectedTofu){
		selectedTofus.push(selectedTofu);
	});
	
	this.on('tofuunselect', function(unselectedTofu){
		selectedTofus.del(unselectedTofu);
	});
};

Ext.extend(tk.yunos.system.FileMgr.Panel, Ext.Panel, {
	border: false
});

tk.yunos.system.FileMgr.Tofu = function(_fileDescriptor, fileMgr, iconSize){
	var fileDescriptor = _fileDescriptor || {};
	iconSize = iconSize || 'medium';		//iconSize='large'|'medium'|'small'
	fileDescriptor.icon = fileDescriptor.icon;
	fileDescriptor.name = fileDescriptor.name || '';			//图标名称，显示在图标下方
	fileDescriptor.desc = fileDescriptor.desc || '';			//描述
	fileDescriptor.mime = fileDescriptor.mime || '';			//mime
	
	if(YOSUtil.isBlankString(fileDescriptor.icon)){
		fileDescriptor.icon = tk.yunos.filesystem.LOGO;
	}
	
	var outbox = document.createElement('div');
	var tofu = Ext.get(outbox);
	var tofuSizeClass = 'tofu-' + iconSize;
	tofu.addClass('tofu-base');
	tofu.addClass(tofuSizeClass);
	
	var iconTag = document.createElement('img');
	iconTag.src = fileDescriptor.icon;
	var textTag = document.createElement('p');
	textTag.innerHTML = fileDescriptor.name;
	
	tofu.appendChild(iconTag);
	tofu.appendChild(textTag);
	tofu.dom.title = fileDescriptor.desc;
	
	Ext.get(textTag).addClassOnFocus('rename');
	
	tofu.getFile = function(){
		return fileDescriptor;
	};
	
	tofu.select = function(){
		tofu.addClass('tofu-selected');
		fileMgr.fireEvent('tofuselect', tofu);
	};
	
	tofu.unselect = function(){
		tofu.removeClass('tofu-selected');
		fileMgr.fireEvent('tofuunselect', tofu);
	};
	
	tofu.rename = function(){
		textTag.contentEditable = true;
		Ext.get(textTag).focus();
		Ext.get(textTag).on('blur', function(){
			textTag.contentEditable = false;
			Ext.get(textTag).un('blur', this);
		});
	};
	
	Ext.get(iconTag).on('click', function(e){
		fileMgr.fireEvent('tofuclick', tofu, e);
	});
	
	Ext.get(textTag).on('click', function(e){
		e.stopPropagation();
		tofu.rename();
	});
	
	tofu.on('contextmenu', function(e){
		fileMgr.fireEvent('tofucontextmenu', tofu, e);
	});
	
	tofu.on('dblclick', function(e){
		fileMgr.fireEvent('tofudbclick', tofu, e);
	});
	
	return tofu;
};

tk.yunos.system.FileMgr.History = function(){
	var history = [];
	var curIndex = -1;	//当前页面在历史中的位置
	this.add = function(absAddress){
		if(absAddress.charAt(0) != '/'){
			//如果不是绝对地址，忽略
			return;
		}
		//历史翻开了新的一页，所以删除当前页之后的所有历史
		history.splice(curIndex + 1);
		history.push(absAddress);
		curIndex = history.length - 1;
	};
	//后退，参数count表示以当前为基准向后退几个历史，默认后退1个
	this.back = function(count){
		if(!count || count <= 0){
			count = 1;
		}
		if(history.length == 0){
			return '';
		}
		if(count > curIndex){
			curIndex = 0;
		}else{
			curIndex = curIndex - count;
		}
		return history[curIndex];
	};
	//前进，参数count表示以当前为基准向前进几个历史，默认前进1个
	this.forward = function(count){
		if(!count || count <= 0){
			count = 1;
		}
		if(count > history.length - 1 - curIndex){
			curIndex = history.length - 1;
		}else{
			curIndex = curIndex + count;
		}
		return history[curIndex];
	};
	//返回所有历史
	this.getHistorys = function(){
		return history;
	};
	//返回所有可后退的历史
	this.getBackableHistorys = function(){
		return history.slice(0, curIndex);
	};
	//返回所有可前进的历史
	this.getForwardableHistorys = function(){
		return history.slice(curIndex + 1);
	};
};

//文件系统结构树
tk.yunos.system.FileMgr.StructTree = function(_config){
	var st = this;
	var config = _config || {};
	var rootPath = config.rootPath;
	var onlyFolder = config.onlyFolder;
	if(typeof(onlyFolder) == 'undefined'){
		onlyFolder = true;
	}
	var expandRoot = config.expandRoot;
	if(typeof(expandRoot) == 'undefined'){
		expandRoot = true;
	}
	
	config.root = new Ext.tree.TreeNode({
		text: '/',
		icon: tk.yunos.filesystem.DEFAULT_MIME['folder'].icon,
		address: rootPath,
		expandable: true,
		expanded: expandRoot
	});
	
	Ext.apply(this, config);
	//调用父类构造方法
	tk.yunos.system.FileMgr.StructTree.superclass.constructor.call(this, config);
	
	this.loadNode = function(node){
		var nodeEl = Ext.get(node.ui.getEl());
		nodeEl.mask('正在加载...');
		tk.yunos.filesystem.getFiles(node.attributes.address, function(success, files){
			if(success){
				node.removeAll(true);
				var childNodes = [];
				for(var i = 0; i < files.length; i++){
					if(files[i].mime == 'folder' || !onlyFolder){
						childNodes.push(new Ext.tree.TreeNode({
							text: files[i].name,
							icon: files[i].icon,
							expandable: files[i].mime == 'folder',
							address: files[i].address,
							fileDescriptor: files[i]
						}));
					}
				}
				nodeEl.unmask();
				node.appendChild(childNodes);
			}else{
				nodeEl.unmask();
			}
		});
	};
	
	this.on('expandnode', this.loadNode);
};

Ext.extend(tk.yunos.system.FileMgr.StructTree, Ext.tree.TreePanel, {
	border: false,
	frame: true,
	autoScroll: true,
	animate: true,
	containerScroll: true,
	split: true,
	collapseMode: 'mini'
});

//分析地址，返回地址的各段文件夹数组
//参数必须是绝对地址
tk.yunos.system.FileMgr.analyzeAddress = function(absAddress){
	var foldArchitecture = [];
	if(!YOSUtil.isBlankString(absAddress) && absAddress.charAt(0) == '/'){
		foldArchitecture.push('/');
		var foldsTmp = absAddress.split('/');
		for(var i = 0; i < foldsTmp.length; i++){
			if(foldsTmp[i] != ''){
				foldArchitecture.push(foldsTmp[i]);
			}
		}
	}
	return foldArchitecture;
};

//连接地址，返回的是绝对地址
tk.yunos.system.FileMgr.joinAddress = function(foldArchitecture){
	if(!foldArchitecture || foldArchitecture.length < 1){
		return '';
	}
	var absAddress = foldArchitecture[0];
	for(var i = 1; i < foldArchitecture.length; i++){
		absAddress += foldArchitecture[i];
		if(i != foldArchitecture.length - 1){
			absAddress += '/';
		}
	}
	return absAddress;
};

tk.yunos.system.FileMgr.appname = '文件管理器';
